package com.xmall.product.define.request.spu;

import com.xmall.validate.group.AddGroup;
import com.xmall.validate.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 返回数据格式：product - spu_image
 */
@Data
public class SkuImageRequest implements Serializable {

    /**
     * spuID
     */
    private Long spuId;

    /**
     * skuId
     */
    private Long skuId;

    /**
     * 编号
     */
    @NotNull(message = "编号不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private Long sn;

    /**
     * 文件名称
     */
    @NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private String name;

    /**
     * 主图地址
     */
    @NotBlank(message = "图片地址不能为空", groups = { AddGroup.class, UpdateGroup.class })
    @URL(message = "图片地址格式错误", groups = { AddGroup.class, UpdateGroup.class })
    private String url;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 大小
     */
    @NotNull(message = "图片大小不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private Long size;

    /**
     * 是否默认（0否 1是）
     */
    @NotNull(message = "是否默认不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private Integer isDefault;
}
